package com.sunwayworld.basemodule.common.asynctask.config;

import com.sunwayworld.framework.exception.InvalidDataException;
import com.sunwayworld.framework.utils.ObjectUtils;

public enum AsyncTaskTypeEnum {
    createReport("createReport","报告生成"),
    reportSign("reportSign","加签名"),
    convertPdf("convertPdf","转PDF");

    private String name;
    public String desc;

    AsyncTaskTypeEnum(String name,String desc) {
        this.name = name;
        this.desc = desc;
    }

    public static AsyncTaskTypeEnum getDesc(AsyncTaskTypeEnum bean) {
        if (ObjectUtils.isEmpty(bean.desc)) {
            throw new InvalidDataException("desc is null");
        }
        AsyncTaskTypeEnum[] values = AsyncTaskTypeEnum.values();
        for (AsyncTaskTypeEnum s : values) {
            if (s.desc.equals(bean.desc)) {
                return s;
            }
        }
        throw new InvalidDataException("desc not found:" + bean.desc);
    }
}
